package com.chinanet.netelementmodel;

import com.chinanet.entry.netelement.Attr;
import com.chinanet.entry.netelement.AttrType;
import com.chinanet.entry.netelement.WorkInterFace;
import com.chinanet.utils.telnet.TelnetWork;
import com.chinanet.utils.telnet.Telnet_Attrsln;

import java.util.HashMap;
import java.util.Map;
/**
 * TelentImp--城域网中继链路有效性监测和主动维护
 * @author xuzhi
 *
 */
public class TelentImp implements WorkInterFace {

	@Override
	public String getName() {
		return "城域网中继链路有效性监测和主动维护";
	}

	@Override
	public String getDesciption() {
		return "测试方法";
	}

	@Override
	public int getVersion() {
		return 0;
	}

	@Override
	public Attr[] getInAttrs() {
		Attr[] in = new Attr[1];
//		in[0] = new Attr("tbIpAddress", "跳板机的ip地址", AttrType.TYPE_String, true);
//		in[1] = new Attr("tbUsername", "跳板机登录用户名", AttrType.TYPE_String, true);
//		in[2] = new Attr("tbPassword", "跳板机登录密码", AttrType.TYPE_String, true);
//		in[3] = new Attr("switchboardIpAddress", "交换机的ip地址", AttrType.TYPE_String, true);
//		in[4] = new Attr("switchboardUsername", "交换机登录用户名", AttrType.TYPE_String, true);
//		in[5] = new Attr("switchboardPassword", "交换机登录密码", AttrType.TYPE_String, true);
		in[0] = new Attr("command", "查询指令", AttrType.TYPE_String, true);
		return in;
	}

	@Override
	public Attr[] getOutAttrs() {
		Attr[] out = new Attr[4];
		out[0] = new Attr("flag", "操作是否成功，1：成功，0：失败", AttrType.TYPE_Int, true);
		out[1]=new Attr("UnselectedPorts","所有的UnselectedPorts",AttrType.TYPE_String,true);
		out[2]=new Attr("rate","合格比率",AttrType.TYPE_String,true);
		out[3]=new Attr("log","日志",AttrType.TYPE_String,true);
		return out;
	}

	@Override
	public Map<String, Object> init(Map<String, Object> data) {
		Map<String,Object> outmap=new HashMap<String, Object>();
		TelnetWork twork=new TelnetWork();
		Telnet_Attrsln attrs=new Telnet_Attrsln();
		attrs.setTbIpAddress("61.174.87.25");
		attrs.setTbUsername("xinchan");
		attrs.setTbPassword("XinChan@0919");
		attrs.setSwitchboardIpAddress("61.175.90.233");
		attrs.setSwitchboardUsername("xinchan");
		attrs.setSwitchboardPassword("XinChan@0919");
		attrs.setCommand((String)data.get("command"));
		outmap=twork.init(attrs);
		return outmap;
	}

}
